﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using Archives.Models.Users;

namespace Archives.Models
{
    public class InitData : DropCreateDatabaseIfModelChanges<ArchivesContext>
    {
        protected override void Seed(ArchivesContext context)
        {

            //Role
            context.Roles.Add(new Role { Name = "Administrator" });
            context.Roles.Add(new Role { Name = "Giám đốc" });
            context.Roles.Add(new Role { Name = "Nhân viên" });

            //Function
            context.Functions.Add(new Function { Name = "Upload data" });
            context.Functions.Add(new Function { Name = "Xem file đã upload" });
            context.Functions.Add(new Function { Name = "Thêm nhân viên" });
            context.Functions.Add(new Function { Name = "Phân quyền" });

            Deparment depart = new Deparment { Id = 1, Name = "GA" };
            context.Deparments.Add(depart);

          

            //User          
            context.Users.Add(new User
            {
                FullName = "ngo van",
                Email = "abc@yahoo.com",
                Username = "abc",
                Password = "123",
                CreateDate = DateTime.UtcNow,
                Active = true,
                Deparment = depart
                
            });
           
        }
    }
}